package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wx.collect.CollectAddordeleteBo;
import com.cskaoyan.bean.wx.collect.CollectAddordeleteVo;
import com.cskaoyan.bean.wx.collect.CollectListBo;
import com.cskaoyan.bean.wx.collect.CollectListVo;
import com.cskaoyan.service.wx.WxCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//向磊

@RestController
@RequestMapping("wx/collect")
public class WxCollectController {

    @Autowired
    WxCollectService wxCollectService;

    //wx/collect/list
    @RequestMapping("list")
    public BaseRespVo list(CollectListBo collectListBo){
        CollectListVo data = wxCollectService.collectList(collectListBo);
        return BaseRespVo.ok(data);
    }

    //wx/collect/addordelete
    @RequestMapping("addordelete")
    public BaseRespVo addordelete(@RequestBody CollectAddordeleteBo collectAddordeleteBo){
        Integer userId = 1;
        String data = wxCollectService.collectAddordelete(collectAddordeleteBo.getType(),
                collectAddordeleteBo.getValueId(),userId);
        //1表示收藏，0表示取消收藏
        return BaseRespVo.ok(new CollectAddordeleteVo(data));
    }
}
